{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "59ec8262",
   "metadata": {},
   "source": [
    "————\n",
    "\n",
    "2022/9/19 /week 05\n",
    "\n",
    "python 学习记录\n",
    "\n",
    "————"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "14d71111",
   "metadata": {},
   "source": [
    "# 本周知识点\n",
    "\n",
    ">1.控制流\n",
    ">>1.条件判断\n",
    ">>2.循环遍历\n",
    "\n",
    "\n",
    ">2.随机函数\n",
    "\n",
    "\n",
    ">3.时间函数"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "61fe19bc",
   "metadata": {},
   "source": [
    "## 1.控制流\n",
    "\n",
    "\n",
    "###1.1条件判断\n",
    "\n",
    "\n",
    "*知识点\n",
    "\n",
    ">1.赋值，是“=”\n",
    "\n",
    ">2.判断两者是否相等是“==”\n",
    "\n",
    ">3.代码中出现的变量，必须先定义，否则：name变量名 is not defeined"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "b49ed3ca",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid character in identifier (<ipython-input-2-4ceb3d66a0fa>, line 3)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-2-4ceb3d66a0fa>\"\u001b[1;36m, line \u001b[1;32m3\u001b[0m\n\u001b[1;33m    taday =“Saturday”\u001b[0m\n\u001b[1;37m                    ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid character in identifier\n"
     ]
    }
   ],
   "source": [
    "#先定义变量today \n",
    "\n",
    "taday =“Saturday”\n",
    "\n",
    "if today ==\"Saturday\":\n",
    "    print(\"Party!\")\n",
    "elif tpday ==\"Sunday\":\n",
    "    if condition ==\"Headache\":\n",
    "        print(\"Recover,then rest.\")\n",
    "    else:\n",
    "        print(\"Rest.\")\n",
    "else:\n",
    "    print(\"Work,work,wrok\")\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "e00918c0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Recover,then rest.\n"
     ]
    }
   ],
   "source": [
    "today =\"Sunday\"\n",
    "condition =\"Headache\"\n",
    "\n",
    "if today ==\"Saturday\":\n",
    "    print(\"Party!\")\n",
    "elif today ==\"Sunday\":\n",
    "    if condition ==\"Headache\":\n",
    "        print(\"Recover,then rest.\")\n",
    "    else:\n",
    "        print(\"Rest.\")\n",
    "else:\n",
    "    print(\"Work,work,wrok\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "8e7458ed",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Work,work,wrok\n"
     ]
    }
   ],
   "source": [
    "today =\"Monday\"\n",
    "condition =\"Headache\"\n",
    "\n",
    "if today ==\"Saturday\":\n",
    "    print(\"Party!\")\n",
    "elif today ==\"Sunday\":\n",
    "    if condition ==\"Headache\":\n",
    "        print(\"Recover,then rest.\")\n",
    "    else:\n",
    "        print(\"Rest.\")\n",
    "else:\n",
    "    print(\"Work,work,wrok\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "3b84f3ec",
   "metadata": {},
   "outputs": [],
   "source": [
    "##关于if else 条件判断实践：\n",
    "##请判断今天是周几，如果是周一，有python课，好开心呀。如果不是，期待周一呀。（time可以帮我们知道今天周几）\n",
    "##                      如果是周一，请判断现在是否正在上python课。（time可以帮我们知道现在是几点钟几分钟。）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "aa048e1c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "be086bc0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=19, tm_hour=10, tm_min=32, tm_sec=56, tm_wday=0, tm_yday=262, tm_isdst=0)"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "1eadb27e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime().tm_wday"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "06340d73",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid character in identifier (<ipython-input-30-cd504b5c71e4>, line 6)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  File \u001b[1;32m\"<ipython-input-30-cd504b5c71e4>\"\u001b[1;36m, line \u001b[1;32m6\u001b[0m\n\u001b[1;33m    print(\"几点\"，today_hour)\u001b[0m\n\u001b[1;37m                        ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid character in identifier\n"
     ]
    }
   ],
   "source": [
    "# tm_wday  0-6  0 是周一\n",
    "#准备工作，准备所有可能用到的变量.\n",
    "wday = time.localtime().tm_wday\n",
    "print(\"周几\",wday)\n",
    "today_hour = time.localtime().tm_hour\n",
    "print(\"几点\"，today_hour)\n",
    "today_min = time.localtime().tm_min\n",
    "print(\"几分\"，today_min)\n",
    "#条件判断，请完成：\n",
    "##关于if else 条件判断实践：\n",
    "##请判断今天是周几，如果是周一，有python课，好开心呀。如果不是，期待周一呀。（time可以帮我们知道今天周几）\n",
    "##                      如果是周一，请判断现在是否正在上python课。（time可以帮我们知道现在是几点钟几分钟。）\n",
    "\n",
    "if day == 0:\n",
    "    print(\"有python课，好开心呀\")\n",
    "    if 9 <today_hour<12:\n",
    "        print(\"现在是\"，today_hour，\"点\"，today_min，\"正在上python\")\n",
    "    elif today_hour == 9:\n",
    "        if  today_min >=45:\n",
    "            print(\"正在上python\")\n",
    "        elif today_min >=30:\n",
    "            print(\"手机弹出框，还有15分钟要上python课了，请提前准备好课本和电脑，检查好电量！\")    \n",
    "        else\n",
    "            print(\"马上就要上python了，好激动呀\")\n",
    "        else\n",
    "        print(\"没在上python\")\n",
    "else：\n",
    "   print(\"期待周一呀\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "26aeb8a7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in module time:\n",
      "\n",
      "NAME\n",
      "    time - This module provides various functions to manipulate time values.\n",
      "\n",
      "DESCRIPTION\n",
      "    There are two standard representations of time.  One is the number\n",
      "    of seconds since the Epoch, in UTC (a.k.a. GMT).  It may be an integer\n",
      "    or a floating point number (to represent fractions of seconds).\n",
      "    The Epoch is system-defined; on Unix, it is generally January 1st, 1970.\n",
      "    The actual value can be retrieved by calling gmtime(0).\n",
      "    \n",
      "    The other representation is a tuple of 9 integers giving local time.\n",
      "    The tuple items are:\n",
      "      year (including century, e.g. 1998)\n",
      "      month (1-12)\n",
      "      day (1-31)\n",
      "      hours (0-23)\n",
      "      minutes (0-59)\n",
      "      seconds (0-59)\n",
      "      weekday (0-6, Monday is 0)\n",
      "      Julian day (day in the year, 1-366)\n",
      "      DST (Daylight Savings Time) flag (-1, 0 or 1)\n",
      "    If the DST flag is 0, the time is given in the regular time zone;\n",
      "    if it is 1, the time is given in the DST time zone;\n",
      "    if it is -1, mktime() should guess based on the date and time.\n",
      "\n",
      "CLASSES\n",
      "    builtins.tuple(builtins.object)\n",
      "        struct_time\n",
      "    \n",
      "    class struct_time(builtins.tuple)\n",
      "     |  struct_time(iterable=(), /)\n",
      "     |  \n",
      "     |  The time value as returned by gmtime(), localtime(), and strptime(), and\n",
      "     |  accepted by asctime(), mktime() and strftime().  May be considered as a\n",
      "     |  sequence of 9 integers.\n",
      "     |  \n",
      "     |  Note that several fields' values are not the same as those defined by\n",
      "     |  the C language standard for struct tm.  For example, the value of the\n",
      "     |  field tm_year is the actual year, not year - 1900.  See individual\n",
      "     |  fields' descriptions for details.\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      struct_time\n",
      "     |      builtins.tuple\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __reduce__(...)\n",
      "     |      Helper for pickle.\n",
      "     |  \n",
      "     |  __repr__(self, /)\n",
      "     |      Return repr(self).\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods defined here:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  tm_gmtoff\n",
      "     |      offset from UTC in seconds\n",
      "     |  \n",
      "     |  tm_hour\n",
      "     |      hours, range [0, 23]\n",
      "     |  \n",
      "     |  tm_isdst\n",
      "     |      1 if summer time is in effect, 0 if not, and -1 if unknown\n",
      "     |  \n",
      "     |  tm_mday\n",
      "     |      day of month, range [1, 31]\n",
      "     |  \n",
      "     |  tm_min\n",
      "     |      minutes, range [0, 59]\n",
      "     |  \n",
      "     |  tm_mon\n",
      "     |      month of year, range [1, 12]\n",
      "     |  \n",
      "     |  tm_sec\n",
      "     |      seconds, range [0, 61])\n",
      "     |  \n",
      "     |  tm_wday\n",
      "     |      day of week, range [0, 6], Monday is 0\n",
      "     |  \n",
      "     |  tm_yday\n",
      "     |      day of year, range [1, 366]\n",
      "     |  \n",
      "     |  tm_year\n",
      "     |      year, for example, 1993\n",
      "     |  \n",
      "     |  tm_zone\n",
      "     |      abbreviation of timezone name\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes defined here:\n",
      "     |  \n",
      "     |  n_fields = 11\n",
      "     |  \n",
      "     |  n_sequence_fields = 9\n",
      "     |  \n",
      "     |  n_unnamed_fields = 0\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from builtins.tuple:\n",
      "     |  \n",
      "     |  __add__(self, value, /)\n",
      "     |      Return self+value.\n",
      "     |  \n",
      "     |  __contains__(self, key, /)\n",
      "     |      Return key in self.\n",
      "     |  \n",
      "     |  __eq__(self, value, /)\n",
      "     |      Return self==value.\n",
      "     |  \n",
      "     |  __ge__(self, value, /)\n",
      "     |      Return self>=value.\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  __getitem__(self, key, /)\n",
      "     |      Return self[key].\n",
      "     |  \n",
      "     |  __getnewargs__(self, /)\n",
      "     |  \n",
      "     |  __gt__(self, value, /)\n",
      "     |      Return self>value.\n",
      "     |  \n",
      "     |  __hash__(self, /)\n",
      "     |      Return hash(self).\n",
      "     |  \n",
      "     |  __iter__(self, /)\n",
      "     |      Implement iter(self).\n",
      "     |  \n",
      "     |  __le__(self, value, /)\n",
      "     |      Return self<=value.\n",
      "     |  \n",
      "     |  __len__(self, /)\n",
      "     |      Return len(self).\n",
      "     |  \n",
      "     |  __lt__(self, value, /)\n",
      "     |      Return self<value.\n",
      "     |  \n",
      "     |  __mul__(self, value, /)\n",
      "     |      Return self*value.\n",
      "     |  \n",
      "     |  __ne__(self, value, /)\n",
      "     |      Return self!=value.\n",
      "     |  \n",
      "     |  __rmul__(self, value, /)\n",
      "     |      Return value*self.\n",
      "     |  \n",
      "     |  count(self, value, /)\n",
      "     |      Return number of occurrences of value.\n",
      "     |  \n",
      "     |  index(self, value, start=0, stop=9223372036854775807, /)\n",
      "     |      Return first index of value.\n",
      "     |      \n",
      "     |      Raises ValueError if the value is not present.\n",
      "\n",
      "FUNCTIONS\n",
      "    asctime(...)\n",
      "        asctime([tuple]) -> string\n",
      "        \n",
      "        Convert a time tuple to a string, e.g. 'Sat Jun 06 16:26:11 1998'.\n",
      "        When the time tuple is not present, current time as returned by localtime()\n",
      "        is used.\n",
      "    \n",
      "    ctime(...)\n",
      "        ctime(seconds) -> string\n",
      "        \n",
      "        Convert a time in seconds since the Epoch to a string in local time.\n",
      "        This is equivalent to asctime(localtime(seconds)). When the time tuple is\n",
      "        not present, current time as returned by localtime() is used.\n",
      "    \n",
      "    get_clock_info(...)\n",
      "        get_clock_info(name: str) -> dict\n",
      "        \n",
      "        Get information of the specified clock.\n",
      "    \n",
      "    gmtime(...)\n",
      "        gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,\n",
      "                               tm_sec, tm_wday, tm_yday, tm_isdst)\n",
      "        \n",
      "        Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a.\n",
      "        GMT).  When 'seconds' is not passed in, convert the current time instead.\n",
      "        \n",
      "        If the platform supports the tm_gmtoff and tm_zone, they are available as\n",
      "        attributes only.\n",
      "    \n",
      "    localtime(...)\n",
      "        localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min,\n",
      "                                  tm_sec,tm_wday,tm_yday,tm_isdst)\n",
      "        \n",
      "        Convert seconds since the Epoch to a time tuple expressing local time.\n",
      "        When 'seconds' is not passed in, convert the current time instead.\n",
      "    \n",
      "    mktime(...)\n",
      "        mktime(tuple) -> floating point number\n",
      "        \n",
      "        Convert a time tuple in local time to seconds since the Epoch.\n",
      "        Note that mktime(gmtime(0)) will not generally return zero for most\n",
      "        time zones; instead the returned value will either be equal to that\n",
      "        of the timezone or altzone attributes on the time module.\n",
      "    \n",
      "    monotonic(...)\n",
      "        monotonic() -> float\n",
      "        \n",
      "        Monotonic clock, cannot go backward.\n",
      "    \n",
      "    monotonic_ns(...)\n",
      "        monotonic_ns() -> int\n",
      "        \n",
      "        Monotonic clock, cannot go backward, as nanoseconds.\n",
      "    \n",
      "    perf_counter(...)\n",
      "        perf_counter() -> float\n",
      "        \n",
      "        Performance counter for benchmarking.\n",
      "    \n",
      "    perf_counter_ns(...)\n",
      "        perf_counter_ns() -> int\n",
      "        \n",
      "        Performance counter for benchmarking as nanoseconds.\n",
      "    \n",
      "    process_time(...)\n",
      "        process_time() -> float\n",
      "        \n",
      "        Process time for profiling: sum of the kernel and user-space CPU time.\n",
      "    \n",
      "    process_time_ns(...)\n",
      "        process_time() -> int\n",
      "        \n",
      "        Process time for profiling as nanoseconds:\n",
      "        sum of the kernel and user-space CPU time.\n",
      "    \n",
      "    sleep(...)\n",
      "        sleep(seconds)\n",
      "        \n",
      "        Delay execution for a given number of seconds.  The argument may be\n",
      "        a floating point number for subsecond precision.\n",
      "    \n",
      "    strftime(...)\n",
      "        strftime(format[, tuple]) -> string\n",
      "        \n",
      "        Convert a time tuple to a string according to a format specification.\n",
      "        See the library reference manual for formatting codes. When the time tuple\n",
      "        is not present, current time as returned by localtime() is used.\n",
      "        \n",
      "        Commonly used format codes:\n",
      "        \n",
      "        %Y  Year with century as a decimal number.\n",
      "        %m  Month as a decimal number [01,12].\n",
      "        %d  Day of the month as a decimal number [01,31].\n",
      "        %H  Hour (24-hour clock) as a decimal number [00,23].\n",
      "        %M  Minute as a decimal number [00,59].\n",
      "        %S  Second as a decimal number [00,61].\n",
      "        %z  Time zone offset from UTC.\n",
      "        %a  Locale's abbreviated weekday name.\n",
      "        %A  Locale's full weekday name.\n",
      "        %b  Locale's abbreviated month name.\n",
      "        %B  Locale's full month name.\n",
      "        %c  Locale's appropriate date and time representation.\n",
      "        %I  Hour (12-hour clock) as a decimal number [01,12].\n",
      "        %p  Locale's equivalent of either AM or PM.\n",
      "        \n",
      "        Other codes may be available on your platform.  See documentation for\n",
      "        the C library strftime function.\n",
      "    \n",
      "    strptime(...)\n",
      "        strptime(string, format) -> struct_time\n",
      "        \n",
      "        Parse a string to a time tuple according to a format specification.\n",
      "        See the library reference manual for formatting codes (same as\n",
      "        strftime()).\n",
      "        \n",
      "        Commonly used format codes:\n",
      "        \n",
      "        %Y  Year with century as a decimal number.\n",
      "        %m  Month as a decimal number [01,12].\n",
      "        %d  Day of the month as a decimal number [01,31].\n",
      "        %H  Hour (24-hour clock) as a decimal number [00,23].\n",
      "        %M  Minute as a decimal number [00,59].\n",
      "        %S  Second as a decimal number [00,61].\n",
      "        %z  Time zone offset from UTC.\n",
      "        %a  Locale's abbreviated weekday name.\n",
      "        %A  Locale's full weekday name.\n",
      "        %b  Locale's abbreviated month name.\n",
      "        %B  Locale's full month name.\n",
      "        %c  Locale's appropriate date and time representation.\n",
      "        %I  Hour (12-hour clock) as a decimal number [01,12].\n",
      "        %p  Locale's equivalent of either AM or PM.\n",
      "        \n",
      "        Other codes may be available on your platform.  See documentation for\n",
      "        the C library strftime function.\n",
      "    \n",
      "    thread_time(...)\n",
      "        thread_time() -> float\n",
      "        \n",
      "        Thread time for profiling: sum of the kernel and user-space CPU time.\n",
      "    \n",
      "    thread_time_ns(...)\n",
      "        thread_time() -> int\n",
      "        \n",
      "        Thread time for profiling as nanoseconds:\n",
      "        sum of the kernel and user-space CPU time.\n",
      "    \n",
      "    time(...)\n",
      "        time() -> floating point number\n",
      "        \n",
      "        Return the current time in seconds since the Epoch.\n",
      "        Fractions of a second may be present if the system clock provides them.\n",
      "    \n",
      "    time_ns(...)\n",
      "        time_ns() -> int\n",
      "        \n",
      "        Return the current time in nanoseconds since the Epoch.\n",
      "\n",
      "DATA\n",
      "    altzone = -32400\n",
      "    daylight = 0\n",
      "    timezone = -28800\n",
      "    tzname = ('中国标准时间', '中国夏令时')\n",
      "\n",
      "FILE\n",
      "    (built-in)\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(time)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8fa0a390",
   "metadata": {},
   "source": [
    "# 2.循环遍历（for）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2f580512",
   "metadata": {},
   "source": [
    ">1.循环迭代数字变量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "652726b8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "for i in [1,2,3]:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8dd7166b",
   "metadata": {},
   "source": [
    ">2.循环迭代字符串变量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "85ca7940",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "H\n",
      "i\n",
      "!\n"
     ]
    }
   ],
   "source": [
    "for ch in\"Hi!\":\n",
    "    print (ch)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d1957164",
   "metadata": {},
   "outputs": [],
   "source": [
    "#上述 i 和 ch 都是变量，可以根据我们的需求定义变量名\n",
    "\n",
    "#每一次执行，赋值一次"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bbc4b118",
   "metadata": {},
   "source": [
    ">3.迭代指定的次数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "c2b11525",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n"
     ]
    }
   ],
   "source": [
    "#range（），范围，变量\n",
    "for num in range (5):\n",
    "    print (\"Head First Rocks!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "90322ab4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hello，world!\n",
      "Hello，world!\n",
      "Hello，world!\n",
      "Hello，world!\n",
      "Hello，world!\n",
      "Hello，world!\n",
      "Hello，world!\n",
      "Hello，world!\n",
      "Hello，world!\n",
      "Hello，world!\n"
     ]
    }
   ],
   "source": [
    "for num in range (10):\n",
    "    print (\"Hello，world!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "a2fcb6ef",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range(0, 5)"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#1.range（）是一个数字/数值生成器\n",
    "\n",
    "#2.range（）包含有 起始点(默认为0) 终止点stop  以及步长step(默认为1)\n",
    "\n",
    "range(5)  #默认的起点是 0 ，终结点 5  产生了5-0个数值，"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "5f1c339c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4]"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(5))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "a08ff512",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range(5, 10)"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "range(5,10)   #自定义起点是 5 ，终结点 10  产生了10-5个数值，默认每次增加1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "63395c87",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[5, 6, 7, 8, 9]"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(5,10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "48084f81",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range(0, 10, 3)"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "range(0,10,3)   #自定义起点是 0 ，终结点 10  产生了(10-0)/3个数值，默认每次增加3 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "32bab62b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 3, 6, 9]"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(0,10,3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "84c17315",
   "metadata": {},
   "outputs": [],
   "source": [
    "#1.练习课本p4，涉及知识点，模块，条件判断\n",
    "\n",
    "#2.练习课本p33 涉及知识点：模块，变量，条件判断，time模块，for循环\n",
    "\n",
    "#3.练习课本p44 涉及知识点：模块，变量，条件判断，time模块，random模块，for循环"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
